home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 January / macformat-020.iso / Shareware City / Developers / apps.to.go / DTS.StyleChat / App.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-05-20  |  4.8 KB  |  141 lines  |  [TEXT/MPS ]

  1. #ifndef __APPHEADER__
  2. #define __APPHEADER__
  3.  
  4. #ifndef __DTSLib__
  5. #include "DTS.Lib.h"
  6. #endif
  7.  
  8. #ifndef __PRINTING__
  9. #include <Printing.h>
  10. #endif
  11.  
  12. #ifndef __TREEOBJ__
  13. #include <TreeObj.h>
  14. #endif
  15.  
  16. /********/
  17.  
  18. #define VH_VERSION  1                /* True means to include ViewHierarchy window.             */
  19. #define DEV_VERSION 1                /* True means allow option-cmd.period escape from dialogs. */
  20.  
  21. /* If you are unfamiliar with programming with the DTS.framework, you probably want to
  22. ** read the file "=How to write your app", which is found at the same level as the
  23. ** directory for this project. */
  24.  
  25. #ifdef powerc
  26. #pragma options align=mac68k
  27. #endif
  28. typedef struct {
  29.     DocHeaderInfo    fhInfo;        /* Doc header info (version, print record, window loc. ) */
  30.     TreeObjHndl        root;
  31.                                 /***** Start of custom file info. *****/
  32.     Handle            textHndl;    /* Temporarily holds opened document text.
  33.                                 ** The document is first read in, and then a
  34.                                 ** window is created for it.  Until the window
  35.                                 ** is created, we can't have a TextEdit control.
  36.                                 ** This field holds the text that was read in
  37.                                 ** when the file was opened.  It is disposed of
  38.                                 ** after the TextEdit control is created and
  39.                                 ** holds the document text. */
  40.     StScrpHandle    textStyl;    /* Same story as textHndl. */
  41.  
  42.     TEHandle        inBox;        /* TextEdit in-box.  */
  43.     TEHandle        outBox;        /* TextEdit out-box. */
  44. } TheDoc;
  45. #ifdef powerc
  46. #pragma options align=reset
  47. #endif
  48.  
  49. /* Below is the master document structure.  All DTS.framework documents use this structure.
  50. ** For each unique document type, union in a sub-structure for the document-specific
  51. ** information.  In the case of AppWannabe, there is only one known document type initially.
  52. ** The structure for this document type is defined just above.  Even though there is only one,
  53. ** it is still placed in a union.  This allows easy addition of additional document types later.
  54. ** Given a FileRec handle called frHndl, a sample dereference to the inBox field would look like:
  55. **     inBox = (*frHndl)->d.doc.inBox;
  56. **
  57. ** The fileState and connect fields are expected and managed by DTS.framework.  Also, the
  58. ** first two fields in the app-specific portion of the document are expected, namely
  59. ** the fhInfo and root fields. */
  60.  
  61. #ifdef powerc
  62. #pragma options align=mac68k
  63. #endif
  64. typedef struct FileRec {
  65.     FileStateRec    fileState;        /* DTS.Lib expects this structure here. */
  66.     ConnectRec        connect;        /* DTS.Lib expects this structure here. */
  67.     union {
  68.         TheDoc    doc;                /* Union in each document type here. */
  69.     } d;
  70. } FileRec;
  71. #ifdef powerc
  72. #pragma options align=reset
  73. #endif
  74.  
  75. /* Below is the definition of the hierarchical document's root object.  If you are using
  76. ** the hierarchical document package TreeObj, then you will need at least this object.
  77. ** TreeObj expects the first two fields to be undo and frHndl, as shown below.  You can
  78. ** add fields after these two fields.  If you use TreeObj, the root object and all of its
  79. ** children are automatically saved and read from disk.
  80. ** Note that the definition for the root object includes a prototype.  Each object is
  81. ** automatically called by DTS.framework at appropriate times.  The prototype defines the
  82. ** function that will be called for this object.  See the files "=How to write your app"
  83. ** and "=Using TreeObj.c" for more information. */
  84.  
  85. #ifdef powerc
  86. #pragma options align=mac68k
  87. #endif
  88. long    TRootObj(TreeObjHndl hndl, short message, long data);
  89. typedef struct {
  90.     TreeObjHndl    undo;        /* This structure may be added to, but */
  91.     FileRecHndl    frHndl;        /* these two first fields must remain. */
  92. } RootObj;
  93. #ifdef powerc
  94. #pragma options align=reset
  95. #endif
  96.  
  97. /********/
  98.  
  99. #define kMaxNumUndos  64
  100. #define kNumSaveUndos 8
  101.  
  102. #define kNumTreeObjs   16        /* Minimum number of objects is 16. */
  103.  
  104. #define mDerefRoot(hndl)     ((RootObj*)((*hndl) + 1))
  105.  
  106. /********/
  107.  
  108. /* These values are passed to the DTS.framework function Initialize(). */
  109. #define kMinHeap    64 * 1024        /* Needs at least 64k of heap space. */
  110. #define kMinSpace    64 * 1024        /* Needs this much after calling PurgeSpace. */
  111.  
  112.  
  113. #define kwAppWindow    (kwGrowIcon | kwHScrollLessGrow | kwVScrollLessGrow | kwVisible | kwOpenAtOldLoc)
  114.     /* Main application window has growIcon, horizontal and vertical document scrollbars,
  115.     ** is initially visible, and if the document is saved, it will open at the location
  116.     ** it was last closed at. */
  117.  
  118. #define keyAppMessage      'KMSG'         /* Custom Apple Event definitions. */
  119. #define typeAppMessage     'KMSG'
  120. #define keyStylMessage     'KSTL'
  121. #define typeStylMessage    'KSTL'
  122. #define typeTextMessage    'KTXT'
  123.  
  124. #define kDisconnectMssg    0
  125. #define kTextMssg        1
  126. #define kStylMssg        2
  127.  
  128. #define kStylResType    'KSTL'
  129. #define kStylResID        20000
  130.  
  131. #define kAutoConnectResType    'AUCN'
  132. #define kAutoConnectResID    20000
  133.  
  134. #define kVersion        100        /* Document versions, not application versions. */
  135. #define kMinVersion        100
  136. #define kMaxVersion        100
  137.  
  138. #define kMaxNumWindows        65535        /* No limit on the number of windows. */
  139.  
  140. #endif
  141.